#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int x;
	vector<int> a;
	cin >> x;
	a.push_back(x);
	while (x != 1) {
		if (x % 2)
			x = x * 3 + 1;
		else
			x = x / 2;
		a.push_back(x);
	}
	for (int i = a.size() - 1; i >= 0; i--)
		cout << a[i] << " ";
	return 0;
}
